﻿@{
    Layout = null;
}
@using MvcContrib.UI.Grid;
@using Webdiyer.WebControls.Mvc;
@model PagedList<ElingOA6_Admin_DSJCJ.Model.Leave>

<!DOCTYPE html>
<html>
<head>
    <title>人员去向信息查阅</title>
     @if (false)
     {
        <script src="../../../../Scripts/jquery-vsdoc.js" type="text/javascript"></script>
        <script src="../../../../Scripts/ASPxScriptIntelliSense.js" type="text/javascript"></script>
     }
        <link href="@Url.Content("~/Content/listTable.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />

    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/FloatDiv.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/My97DatePicker/WdatePicker.js", true)" type="text/javascript"></script>
       @Html.DevExpress().GetStyleSheets(

                new StyleSheet { ExtensionType = ExtensionType.GridView, Theme = DevExpressHelper.Theme }

)
    @Html.DevExpress().GetScripts(
                    new Script { ExtensionType = ExtensionType.ListBox }
    )
   <script>

       function Search() {
           window.location.href = rootPath + "/Admin/FrontShow/LeaveShow?name=" + $("#nametxt").val() + "&&date=" + $("#date").val() + "&&cdLeaveReason=" + $("#cx_lb").val() + "&&type=Q";
       }

       function Refresh() {
           window.location.href = rootPath + "/Admin/FrontShow/LeaveShow?type=F";
       }

       function myCalendar(fmt) {
           WdatePicker({
               readOnly: true,
               dateFmt: fmt
           });
       }

       function iframeAutoFit() {
           var ex;
           try {
               if (window != parent) {
                   var a = parent.document.getElementsByTagName("IFRAME");
                   for (var i = 0; i < a.length; i++) {
                       if (a[i].contentWindow == window) {
                           var h1 = 0, h2 = 0;
                           if (document.documentElement && document.documentElement.scrollHeight) {
                               h1 = document.documentElement.scrollHeight;
                           }
                           if (document.body) h2 = document.body.scrollHeight;
                           var h = Math.max(h1, h2);
                           if (window.ActiveXObject) { h += 4; }
                           else { h += 4; }
                           a[i].style.height = h + "px";
                           window.removeEventListener('resize', iframeAutoFit, false); //兼容谷歌浏览器时要去掉RISZE监听
                       }
                   }
               }
           }
           catch (ex) { }
       }
    
   </script>
</head>
<body style=" font-size:12px"  onload="iframeAutoFit()">
    <br />
    <table width="900px" cellspacing="0" cellpadding="0" align="center" style=" border:0px">
        <tr>
            <td height="20" align="left" style=" border:0px; width:240px">
                <font color="black" size="3" style="font-weight: bold">人员去向信息查阅</font></td>
       
                <td align="right" style=" border:0px; width:40px">
                <b> 姓名:</b> 
                </td>
                <td style=" border:0px">
                @if (ViewData["name"] != null && ViewData["name"] != "")
                {
                     <input type="text" id="nametxt" name="nametxt" value="@ViewData["name"]" style=" width: 140px" />
                }
                else
                {
                      <input type="text" id="nametxt" name="nametxt" style=" width: 140px"  />
                }
                </td>
                <td align="left" style=" border:0px ">
                <select name="cx_lb" id="cx_lb" style=" width:150px">
                 		  <option value="">请选择状态进行查询</option>
                 @foreach (ElingOA6_Admin_DSJCJ.Model.CdLeaveReason CdLeaveReasonmodel in ViewData["CdLeaveReasonList"] as List<ElingOA6_Admin_DSJCJ.Model.CdLeaveReason>)
                 {
                     
                     if (ViewData["cdLeaveReason"]!=null&&CdLeaveReasonmodel.FLeaveReasonCd == ViewData["cdLeaveReason"].ToString())
                     {
                          <option value="@CdLeaveReasonmodel.FLeaveReasonCd" selected="selected">@CdLeaveReasonmodel.FLeaveReasonName</option>
                     }
                     else
                     {
                            <option value="@CdLeaveReasonmodel.FLeaveReasonCd">@CdLeaveReasonmodel.FLeaveReasonName</option>
                     }
                 }
                        </select>
                 </td>
                 <td align="right" style=" border:0px; text-align:left ; width:40px">
               <b>  时间: </b>
               </td>
               <td align="left">
               @if (ViewData["date"] != null && ViewData["date"].ToString() != "")
               {
                     <input name="date" id="date" value="@ViewData["date"]" onclick="myCalendar('yyyy-MM-dd HH:mm')"  class="Wdate" style="width:150px" /> 
               }
               else
               {
                     <input name="date" id="date" value="@DateTime.Now.ToString("yyyy-MM-dd HH:mm")" onclick="myCalendar('yyyy-MM-dd HH:mm')"  class="Wdate" style="width:150px" /> 
               }
                 </td>
                 <td align="center" style=" border:0px">
                 <input type="button" onclick="Search()" title="查询" value="查询" style=" width:40px" />

                 </td>
                 <td align="center" style=" border:0px">
                 <input type="button" onclick="Refresh()" title="刷新数据" value="刷新数据" style=" width:60px" />

                 </td>


           
        </tr>
        
    </table>
    <hr  style=" width:900px;height:2px"/>
   <table width="900px" border="0" align="center" cellpadding="0" cellspacing="0" class="listTable" >
            <tr>
               <td width="10%" height="31" align="center" ><font>
                     @Html.DevExpress().Label(settings => { settings.Text = "人员"; settings.Properties.Style.Font.Size = 9; }).GetHtml() 
                    </font></td>
                <td width="50%" height="31"  align="center" ><font>
                     @Html.DevExpress().Label(settings => { settings.Text = "原因"; settings.Properties.Style.Font.Size = 9; }).GetHtml() 
                    </font></td>
                <td width="27%" height="31" align="center" ><font>
                     @Html.DevExpress().Label(settings => { settings.Text = "时间"; settings.Properties.Style.Font.Size = 9; }).GetHtml() 
                    </font></td>
                <td width="13%" align="center" ><font>
                     @Html.DevExpress().Label(settings => { settings.Text = "更新时间"; settings.Properties.Style.Font.Size = 9; }).GetHtml() 
                    </font></td>
            </tr>
            @if (@Model.TotalItemCount != 0)
            {
                int i = @Model.CurrentPageIndex;
                i = (i - 1) * 15 + 1;
                foreach (var item in Model)
                {

                    ///判断是否为外出和签退时间没空 显示为率色判断
                    ///1.外出未签退显示绿色
                    ///2.外出已签退显示黑色
                    ///3.请假和外出时间未到底色显示黑色
                    if (item.FSignOutDate == null && item.FClass == "2")
                    {
                        if (item.FBeginDate < DateTime.Now)
                        {
                         <tr class="listStyle">
                     <td  align="center"  style=" font-size:12px"  >
                      <a href="@Url.Content("~/Admin/FrontShow/LeaveLook?id=" + item.FLeaveID + "")" target="_blank">@item.FEmplName</a>
                    </td>
                    <td  height="31" style=" font-size:12px" >
                         @item.FLeaveReasonName:@item.FReason
                    </td>
                    <td  align="center" style=" font:14px" >

                       @Html.DevExpress().Label(settings => { settings.Text = item.FBeginDate.ToString("yyyy-MM-dd HH:mm"); settings.Properties.Style.Font.Size = 9; }).GetHtml() 
                       至
                        @Html.DevExpress().Label(settings => { settings.Text = @item.FEndDate.ToString("yyyy-MM-dd HH:mm"); settings.Properties.Style.Font.Size = 9; settings.ControlStyle.ForeColor = System.Drawing.Color.Green; }).GetHtml()
                    </td>
                    <td  align="center" >
                      @Html.DevExpress().Label(settings => { settings.Text = item.FUpdDateStr.ToString(); settings.Properties.Style.Font.Size = 9; }).GetHtml() 
                       </td>
                     
                </tr>
                        }
                        else
                        {
                   <tr class="listStyle" style=" background-color:#999999">
                         <td  align="center"  style=" font-size:12px"  >
                      <a href="@Url.Content("~/Admin/FrontShow/LeaveLook?id=" + item.FLeaveID + "")" target="_blank">@item.FEmplName</a>
                    </td>
                    <td  height="31" style=" font-size:12px" >
                  @item.FLeaveReasonName:@item.FReason
                    </td>
                    <td  align="center" >
                      
                       @Html.DevExpress().Label(settings => { settings.Text = item.FBeginDate.ToString("yyyy-MM-dd HH:mm"); settings.Properties.Style.Font.Size = 9; }).GetHtml() 
                       至
                        @Html.DevExpress().Label(settings => { settings.Text = @item.FEndDate.ToString("yyyy-MM-dd HH:mm"); settings.Properties.Style.Font.Size = 9; settings.ControlStyle.ForeColor = System.Drawing.Color.Green; }).GetHtml()
                    </td>
                    <td  align="center" >
                      @Html.DevExpress().Label(settings => { settings.Text = item.FUpdDateStr.ToString(); settings.Properties.Style.Font.Size = 9; }).GetHtml() 
                     </td>
                     
                </tr>
                        }

                    }
                    else
                    {
                        if (item.FBeginDate < DateTime.Now)
                        {
                <tr class="listStyle">
                       <td  align="center"  style=" font-size:12px"  >
                      <a href="@Url.Content("~/Admin/FrontShow/LeaveLook?id=" + item.FLeaveID + "")" target="_blank">@item.FEmplName</a>
                    </td>
                    <td  height="31" style=" font-size:12px" >
                  @item.FLeaveReasonName:@item.FReason
                    </td>
                    <td  align="center" >
                         @Html.DevExpress().Label(settings => { settings.Text = item.ShowDate; settings.Properties.Style.Font.Size = 9; }).GetHtml() 
                    </td>
                    <td  align="center" >
                      @Html.DevExpress().Label(settings => { settings.Text = item.FUpdDateStr.ToString(); settings.Properties.Style.Font.Size = 9; }).GetHtml() 
                       </td>
                     
                </tr>
                        }
                        else
                        {
                   <tr class="listStyle" style=" background-color:Gray">
                              <td  align="center"  style=" font-size:12px"  >
                      <a href="@Url.Content("~/Admin/FrontShow/LeaveLook?id=" + item.FLeaveID + "")" target="_blank">@item.FEmplName</a>
                    </td>
                    <td  height="31" style=" font-size:12px" >
                   @item.FLeaveReasonName:@item.FReason
                    </td>
                    <td  align="center" >
                         @Html.DevExpress().Label(settings => { settings.Text = item.ShowDate; settings.Properties.Style.Font.Size = 9; }).GetHtml() 
                    </td>
                    <td  align="center" >
                      @Html.DevExpress().Label(settings => { settings.Text = item.FUpdDateStr.ToString(); settings.Properties.Style.Font.Size = 9; }).GetHtml() 
                     </td>
                     
                </tr>
                        }
                    }
                    i = i + 1;
                }

            }
            else
            {
                <tr>
                    <td align="center" colspan="4" style=" font-size:14px">
                        
                           <b> 暂无数据</b>
                    </td>
                </tr>
            }
            @*<tr>
                <td align="center" colspan="4">
                    <span style="float: left; width: 30%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;共 @Model.TotalItemCount 条记录，页 @Model.CurrentPageIndex/@Model.TotalPageCount </span>
                    @Html.Pager(Model, new PagerOptions { ContainerTagName = "span", PageIndexParameterName = "id", AlwaysShowFirstLastPageNumber = true, HorizontalAlign = "right", FirstPageText = "第一页", LastPageText = "最后一页 " }, new { style = "float:right;width:70%" })
                </td>
                </tr>*@
        </table>
        <table width="900px" border="0" cellspacing="0" cellpadding="0" align="center" style=" border:0px" >
            <tr class="">
                <td style=" border:0px">
                    <a><span style="float: left; width: 25%">&nbsp;共 @Model.TotalItemCount 条记录，页 @Model.CurrentPageIndex/@Model.TotalPageCount </span></a>
                    @Html.Pager(Model, new PagerOptions { ContainerTagName = "span", PageIndexParameterName = "id", AlwaysShowFirstLastPageNumber = true, HorizontalAlign = "right", FirstPageText = "第一页", LastPageText = "最后一页 " }, new { style = "float:right;width:75%" })
                </td>
            </tr>
        </table>
</body>
</html>
